class People {

    constructor(name) {
        this.name = name;
        this.age = 20;
    }

    sayHi() {
        console.log(this);
    }

}

let p = new People("张三");
p.sayHi();